-
Notifications
You must be signed in to change notification settings - Fork 2.6k
ui/ux feat: add right-click menu item (jump to last checkpoint) #3160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
| }, | ||
| { | ||
| "command": "roo-cline.jumpToLastCheckpoint", | ||
| "title": "Last Checkpoint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider internationalizing the command title for 'jumpToLastCheckpoint' (e.g., using a placeholder similar to other commands) to ensure consistency with other user-facing texts.
| "title": "Last Checkpoint", | |
| "title": "%command.jumpToLastCheckpoint.title%", |
This comment was generated because it violated a code review rule: mrule_JLtLS6tLppVEv8iV.
|
|
||
| // --- jumpToLastCheckpoint function (existing, correct) --- | ||
| export function jumpToLastCheckpoint( | ||
| virtuosoRef: React.RefObject<any>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a more specific type rather than React.RefObject<any> for the virtuosoRef parameter to improve type safety. Additionally, review the debug console.log statements; they are useful for development but might be removed or replaced with a proper logging mechanism in production.
This comment was generated because it violated a code review rule: mrule_QkEwsCio7v34DaCF.
|
This is a good call-out, but any other functions we'd specifically like to include? |
|
(Fwiw: I think "Jump to Last Checkpoint" is a good feature but it does feel weird as a right-click feature.) |
Yeah, I agree it feels a bit off. IMO it's the design, not the function per say. For something that feels inherent I would switch it to a two-layer dropdown: e.g. Checkpoints -> [List of timestamped checkpoints] For other quick actions maybe new task. Maybe like select all and copy is convenient. MCP servers can have their own dropdowns if they have settings like extensions in chrome. We could add logs if you right click a particular API request "Inspect" and get the raw x, y, z. |
|
I'll close this one for now, I think any version of checkpoint jumping is going to use a different mechanism. Let's return to this in a little bit after we've done some other UI changes. |
Context
I noticed there is no usage of the right-click menu except for default Cut, Copy, Paste. The purpose of this PR is to demonstrate how to add items to the right-click menu so we can potentially use this going forward for more quality of life features.
Implementation
PR Description: Establish Pattern for Custom Webview Context Menu Actions
Purpose:
This PR establishes a reusable pattern for adding custom commands to the VS Code context menu within the Roo Cline webview (
roo-cline.SidebarProviderandroo-cline.TabPanelProvider). It implements the "Jump to Last Checkpoint" feature as the first example utilizing this pattern, allowing users to navigate the chat view to the most recently saved checkpoint via a right-click action.Pattern Overview:
The pattern involves three main parts:
package.json): Define a new command and add it to thewebview/contextmenu contribution point. This makes the command visible in the webview's right-click menu.Roo-Code/src/activate/registerCommands.ts): Register a command handler in the extension that, when triggered, sends a specific message (e.g.,{ type: "action", text: "yourActionName" }) to the active webview.Roo-Code/webview-ui/src/components/chat/ChatView.tsx): Update thehandleMessagefunction in the webview to listen for the specific message text sent by the extension command and execute the corresponding frontend logic.Implementation: "Jump to Last Checkpoint" Example:
This PR applies the pattern described above to implement the "Jump to Last Checkpoint" feature:
package.json:roo-cline.jumpToLastCheckpointcommand.contributes.menus["webview/context"].Roo-Code/src/activate/registerCommands.ts:roo-cline.jumpToLastCheckpointcommand handler.{ type: "action", text: "jumpToCheckpoint" }to the webview.Roo-Code/webview-ui/src/components/chat/ChatView.tsx:handleMessagefunction to check formessage.text === "jumpToCheckpoint"within thecase "action":block.jumpToLastCheckpointutility function (imported from the newly createdcheckpoint-navigation.ts).handleMessageis defined after its dependencies (likegroupedMessages) and includes them in its dependency array.Roo-Code/webview-ui/src/utils/checkpoint-navigation.ts(New File):findLastCheckpointIndex,jumpToCheckpoint, etc.) needed for the checkpoint navigation logic.Adding Future Context Menu Actions:
To add a new custom context menu action in the future, follow this pattern:
package.json.registerCommands.tsthat sends a unique message (e.g.,{ type: "action", text: "newFeatureAction" }) to the webview.else if (message.text === "newFeatureAction") { ... }block within thecase "action":section ofhandleMessageinChatView.tsxto call the relevant frontend function for the new feature.Files Modified:
package.jsonRoo-Code/src/activate/registerCommands.tsRoo-Code/webview-ui/src/components/chat/ChatView.tsxRoo-Code/webview-ui/src/utils/checkpoint-navigation.ts(Created)Testing:
Manual testing confirmed:
Important
Adds a right-click menu item to jump to the last checkpoint in the chat view, with command registration and webview handling for seamless navigation.
package.json.roo-cline.jumpToLastCheckpointinregisterCommands.ts.{ type: "action", text: "jumpToCheckpoint" }to webview.handleMessageinChatView.tsxto handlejumpToCheckpointaction.jumpToLastCheckpointfromcheckpoint-navigation.ts.checkpoint-navigation.tsfor checkpoint navigation logic.findLastCheckpointIndexandjumpToCheckpoint.This description was created by
for a0655a2. You can customize this summary. It will automatically update as commits are pushed.